//给定一个整型数组, 实现冒泡排序(升序排序)

import java.lang.reflect.Array;
import java.util.Arrays;

public class Bubble_Sort {
    public static void bubbleSort(int [] arr){
        int i=0;
        int j=0;
        int temp=0;
        for (i = 0; i < arr.length-1; i++) {
            for ( j = 0; j < arr.length-i-1; j++) {
                if(arr[j]>arr[j+1]){
                    temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
    }
    public static void main(String[] args) {
        int [] arr=new int []{2,3,1,4,5,6,1,9,7,8,0};
        bubbleSort(arr);
        System.out.println(Arrays.toString(arr));
    }
}
